﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<style type="text/css">

</style>

<title>预约项目管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 预约项目管理<a class="btn btn-success btn-refresh radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:void(0);"  onclick="refresh();" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="pd-20">
 <form  id="queryForm" action="" method="post" class="form form-horizontal" >
     <div class="row cl">
      <label class="form-label col-2">项目名称：</label>
      <div class="formControls col-4">
         <input type="text" class="input-text"  placeholder="" id="projectName" name="projectName" value="">
      </div>
       <label class="form-label col-2">预约时间：</label>
       <div class="formControls col-2" style="display:inline;">
           <input type="text"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'1960-01-01 00:00:00',maxDate:'2050-12-31 00:00:00'})" id="startTime" name="startTime" class="input-text Wdate" style="width:90%" value="" >
        &nbsp;&nbsp;<label>-</label>
       </div>
       <div class="formControls col-2" style="display:inline;">
           <input type="text"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'1960-01-01 00:00:00',maxDate:'2050-12-31 00:00:00'})" id="endTime" name="endTime" class="input-text Wdate" style="width:90%" value="" >
       </div>
    </div>
  
     <div class="row cl">
      <label class="form-label col-2">签约方式：</label>
      <div class="formControls col-4">
           <span class="select-box"><select class="select"  size="1" id="reserveType" name="reserveType" >
		      	<option value="0" selected="selected">请选择</option>
			     <c:if test="${reserveTypeList !=null}">
				       <c:forEach items="${reserveTypeList}" var="pl">
				        <option value="${pl.value}"> ${pl.description}</option>
				       </c:forEach>
			      </c:if>
		   </select></span>
      </div>
      <label class="form-label col-2">预约金额：</label>
      <div class="formControls col-4">
         <input type="text" class="input-text" style="width:96%"  placeholder="" id="preAmount" name="preAmount" value=""><label>万</label>
      </div>
    </div>
    
    <div class="row cl">
      <label class="form-label col-2">客户姓名：</label>
      <div class="formControls col-4">
         <input type="text" class="input-text"   placeholder="" id="customerName" name="customerName" value="">
      </div>
      <label class="form-label col-2">理财经理：</label>
      <div class="formControls col-4">
         <input type="text" class="input-text"  placeholder="" id="userName" name="userName" value="">
      </div>
    </div>
    
    <div class="row cl">
      <label class="form-label col-2">客户电话：</label>
      <div class="formControls col-4">
         <input type="text" class="input-text"   placeholder="" id="mobileNumber" name="mobileNumber" value="">
      </div>
      <label class="form-label col-2">认购状态：</label>
      <div class="formControls col-4" >
         <span class="select-box" >
            <select class="select"  size="1" id="status" name="status" >
		      	<option value="0" selected="selected">全部</option>
			     <c:if test="${statusList !=null}">
				       <c:forEach items="${statusList}" var="pl">
				        <option value="${pl.value}"> ${pl.description}</option>
				       </c:forEach>
			      </c:if>
		   </select>
		 </span>
      </div>
    </div>
     <div class="row cl">
         <label class="form-label col-2">申请类型：</label>
	      <div class="formControls col-4" >
	         <span class="select-box" >
	            <select class="select"  size="1" id="type" name="type" >
			      	<option value="0" selected="selected">全部</option>
				     <c:if test="${typeList !=null}">
					       <c:forEach items="${typeList}" var="pl">
					        <option value="${pl.value}"> ${pl.description}</option>
					       </c:forEach>
				      </c:if>
			   </select>
			 </span>
	      </div>
	      <label class="form-label col-2"> </label>
       <div class="formControls col-4">
          <button type="button" class="btn btn-success radius" id="queryBtn" name="queryBtn"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
          &nbsp;&nbsp;&nbsp;
          <button type="button" class="btn btn-success radius" id="exportBtn" name="exportBtn"><i class="Hui-iconfont">&#xe665;</i> 导出</button>
       </div>
     </div>
			
	    
	</form>
	<%-- <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><!-- <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> --> <a href="javascript:;" onclick="member_add('新增客户','<%=basePath%>custmgr/toadd','','650')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a></span> <!-- <span class="r">共有数据：<strong><span id="count"></span></strong> 条</span> --> </div>
	 --%><div class="mt-20">
	<table id="resultTable" class="table table-striped table-border table-bordered" cellspacing="0" width="100%" role="grid" aria-describedby="example_info" style="width: 100%;">
		<thead>
			<tr class="text-c">
				<th width="80">ID</th>
				<th width="">项目名称</th>
				<th width="">认购金额(万)</th>
				<th width="">签约方式</th>
				<th width="">客户信息</th>
				<th width="">当前认购状态</th>
				<th width="">理财经理</th>
				<th width="">预约日期</th>
				<th width="80">操作</th>
			</tr>
		</thead>
		<tbody>
		    <tr>
				<td colspan="9"></td> 
			</tr>
			
		</tbody>
	</table>
	
	<form  id="queryForm2"   method="post" class="form form-horizontal" >
	     <input type="hidden" name="projectId" id="projectId" value="0">
	</form>
	<div class="mt-20">
	<br/><br/>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><span>流程详情:</span></div>
	 
	<table id="resultTable2" class="table table-striped table-border table-bordered " width="100%">  
		<thead>
			<tr class="text-c">
				<th width="80">ID</th>
				<th width="">项目名称</th>
				<th width="">完成时间</th>
				<th width="">环节名称</th>
				<th width="">环节值</th>
				<th width="">备注</th>
			</tr>
		</thead>
		<tbody>
		    <tr>
				<td colspan="9"></td> 
			</tr>
			
		</tbody>
	</table>
	
</div>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/laypage/1.2/laypage.js"></script> 

<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/My97DatePicker/WdatePicker.js"></script> 

<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="<%=basePath%>common/js/cms.js"></script> 
<script type="text/javascript" src="<%=basePath%>common/js/dt.ext.js"></script>
<script type="text/javascript">
$(function(){
	
	var resultTable = null ;
	var resultTable2 = null ;
	function search(){
		resultTable = $('#resultTable').dataTable({
			// "aaSorting": [[ 1, "ASC" ]],//默认第几个排序
			//"bStateSave": false,//状态保存
			//"aoColumnDefs": [
			//  {"bVisible": false, "aTargets": [ 3 ]},  //控制列的隐藏显示
			//  {"orderable":false,"aTargets":[0]}// 制定列不参与排序 
			//] ,
			//"bAutoWidth":true  ,  // 自动宽度
			"ordering": false,
    		"info":     true ,
    		"searching":     false ,
    		 "pagingType": "full_numbers" , // simple  simple_numbers  full  full_numbers 
    		"lengthMenu": [ 20, 50] ,
    		// "scrollY": 300,
            // "scrollX": false ,
			"processing": true,                    //加载数据时显示正在加载信息  
	        //"bServerSide": true,                    //指定从服务器端获取数据  
	        "serverSide": true,
	        //"iDisplayLength": 9,					//每页显示10 条数据
	        "ajax": {
	               "url":"<%=basePath%>projectmgr/query",
	               "data": function ( d ) {
	                   //添加额外的参数传给服务器
	                   d.extra_search = $("#queryForm").serialize();
	               }},
	        "columns": [
	                    { "data": "id" },
	                    { "data": "projectName" },
	                    { "data": "preAmount" },
	                    { "data": "reserveTypeDesc" },
	                    { "data": null },
	                    { "data": "statusDesc" },
	                    { "data": "userName" },
	                    { "data": "createTimeDesc" }  ,
	                    { "data": null }  
	                  ] ,
	       "columnDefs": [ {
				    	   "targets": 4 ,
				    	   "data":null ,
				    	   render:function(a,b,c,d){
				    		   return  "<a href=\"custmgr/toedit?type=3&customerId="+c.customerId+"\" target=\"_blank\"  ><font color=\"blue\">"+c.customerName+"</font></a><br/>"+c.mobileNumber ; 
				    	       }
				          },
				          { "targets": 8,
	                        "data": null,
	                         render: function (data,type,c,meta) {
	                    	  var  html = "<a  title=\"编辑\" href=\"javascript:void(0)\" onclick=\"edit('编辑', '"+c.id+"','','650');\" class=\"ml-5\" style=\"text-decoration:none\"><i class=\"Hui-iconfont\">&#xe6df;</i>编辑</a>" ;
	                          return html;
	                      } ,
	                       "defaultContent": "<button>Click!</button>"
	                  } ] ,
	             "oLanguage":{
	    	   "sProcessing":"数据正在加载..." ,
	    	   "sLengthMenu":"每页显示 _MENU_ 条记录" , 
	    	   "sZeroRecords":"没有查到数据" ,
	    	   "sInfo":"从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
	    	   "oPaginate": {
                   "sFirst":    "首页",
                   "sPrevious": "上一页",
                   "sNext":     "下一页",
                   "sLast":     "末页",
                   "sJump":     "跳转"
               },
	       } ,
	       "sZeroRecords:":"没有查到数据"
	         
		});
	}
	// 给最后一列加一个事件
	/* $('#resultTable tbody').on( 'click', 'button', function () {
		//alert(resultTable) ;
		  var table = $('#resultTable').DataTable();   // 一定要先用这句取出对象 
        // var data = table.row( $(this).parents('tr') ).data();
       // alert( data[0] +"'s salary is: "+ data[ 5 ] );
		// var id = $('#resultTable tbody tr').find("td").eq(0).text(); 
    }); */
	
	// 给每一行加一个事件 查看事件
	 $('#resultTable tbody').on('click','tr', function () {
		    // $(this).addClass("cursor:pointer") ;
		     if ( $(this).hasClass('selected') ) {
	            $(this).removeClass('selected');
	        }
	        else {
	        	resultTable.$('tr.selected').removeClass('selected');
	            $(this).addClass('selected');
	        } 
		      var table = $('#resultTable').DataTable();
		      var data = table.row( $(this) ).data();   // 取出一行对象
		     // var data_len = table.rows('.selected').data().length ;
		     
		    var projectIdVal = data.id; 
		    // console.log(projectIdVal) ;
		    $("#projectId").val(projectIdVal);
		    resultTable2.fnReloadAjax("<%=basePath%>projectmgr/querypw?"+$("#queryForm2").serialize()) ; 
	 }); 
	 
	  $('#queryBtn').click(function(){
	     resultTable.fnReloadAjax("<%=basePath%>projectmgr/query?"+$("#queryForm").serialize()) ; 
	});  
	
	  // 导出 
	  $("#exportBtn").click(function(){
		  document.forms[0].action='<%=basePath%>projectmgr/export' ;
		  document.forms[0].submit();
		 
	  });
	 // init search 
	 search();
	 
	 function search2(){
			resultTable2 = $('#resultTable2').dataTable({
				"ordering": false,
	    		"info":     false ,
	    		"searching":     false ,
	    		"paging": false ,
	    		"pagingType": "full_numbers" , // simple  simple_numbers  full  full_numbers 
	    		"lengthMenu": [ 20, 50] ,
				"processing": false,                    //加载数据时显示正在加载信息  
		        "serverSide": true,
		        "ajax": {
		               "url":"<%=basePath%>projectmgr/querypw",
		               "data": function ( d ) {
		                   //添加额外的参数传给服务器
		                   d.extra_search = $("#queryForm2").serialize();
		               }},
		        "columns": [
		                    { "data": "id" },
		                    { "data": "projectName" },
		                    { "data": "createTimeDesc" },
		                    { "data": "description" },
		                    { "data": "status" },
		                    { "data": "comments" } 
		                  ]  ,
		                  "oLanguage":{
		       	    	   "sProcessing":"数据正在加载..." ,
		       	    	   "sZeroRecords":"没有查到数据" 
		       	       } 
		         
			});
		}
	 
	 search2();
	 
});


 
/*-编辑*/
function  edit(title,id,w,h){
	 var url ="<%=basePath%>projectmgr/toedit?projectId="+id ;
	//  layer_show(title,url,w,h);
	 var index = layer.open({
			type: 2,
			title: title,
			content: url
		});
		layer.full(index);  
}

 
/**
 * 刷新
 */
function refresh(){
	 location.replace(location.href);
}
</script> 
</body>
</html>